# raise抛出异常
try:
    num = input("请输入一个数字:")
    if not num.isdigit():
        raise ValueError("num必须是数字")
except Exception as e:
    print("引发异常",repr(e))